﻿@{
    ViewBag.Title = "交作业";
    Layout = "~/Views/Shared/_LayoutDualColumns.cshtml";
}
@model Ducu.SRV.ViewModel.Task.FulfilModel
@section PageHeader{
    <span class="glyphicon glyphicon-check" aria-hidden="true"></span><span class="after-glyphicon">@ViewBag.Title</span>
}
@{
    object planId = ViewContext.RouteData.Values["planId"];
}
@Html.Action("_ShowItem", "Plan", new { id = planId })
@using (Html.BeginForm())
{
    <div class="form-group">
        <label>任务所属时间：</label>
        @Html.Partial("Shared/_SevenDays", Model.WeekDays)
        <span class="field-validation-error" id="atLeastOneDay">@ViewBag.AtLeastOneDay</span>
        <script>
            $(document).ready(function () {
                $("form").submit(function () {
                    var selectedDayNumber = $("input[name='TaskItem.CompleteDate']:checked").length;
                    if (selectedDayNumber == 0) {
                        $("#atLeastOneDay").text("* 至少选择一个交作业时间");
                        return false;
                    }
                })
            })
        </script>
    </div>
    if (Model.NeedFulfil)
    {
        <div class="form-group">
            <label>留言说明：</label>
            @Html.TextAreaFor(m => m.TaskItem.Comment, new { @class = "form-control", rows = "3", placeholder = "辛苦了！任务完成了，留下点什么吧？" })
        </div>
        <div class="submit">
            <input type="submit" class="btn btn-primary" value="提交" />
            <a href="/Task/_Leave?planId=@planId" id="apply-leave" class="btn btn-default">请假</a>
        </div>
    }
    else
    {
        <div class="well">
            <img src="/Image/applause.png" class="pull-right" />
            <h3><span class="glyphicon glyphicon-thumbs-up" style="color: red; position: relative; top:4px; margin-right: 8px;"></span>了不起！</h3>
            <hr />
            <p>哈哈，这个目标的当前任务你已经全部完成了哟！</p>
        </div>
    }
}
@Html.Partial("Shared/_HistoryContainer")
@section RightPanel{
    <li>
        超过“延期”天数的作业不能再提交。
    </li>
    <li>
        点击作业完成情况图标，可以显示其提交、拒收、验收等历史记录。图标的具体含义见<a href="/About/Icon">帮助</a>。
    </li>
    <li>
        留言说明可以是任务完成情况的详细说明，或者自己的感悟、自我激励，以及其他一切你想说的东西。
    </li>
}
